package com.jkj.http.sys.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.jkj.http.sys.dao.SysLogDao;
import com.jkj.http.sys.entity.SysLog;
import com.jkj.http.sys.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LogServiceImp implements LogService {
	@Autowired
	private SysLogDao sysLogDao;


	@Override
	public int write(String logLevel, String operation, String message, String account, String realName, String ip, String browser) {
		SysLog entity = new SysLog();
		entity.setId(IdUtil.simpleUUID());
		entity.setCreateTime(DateUtil.date());
		entity.setLogLevel(logLevel);
		entity.setOperation(operation);
		entity.setMessage(message);
		entity.setAccount(account);
		entity.setRealName(realName);
		entity.setIp(ip);
		entity.setIpAddress("");
		entity.setBrowser(browser);
		return sysLogDao.insert(entity);
	}

}
